package com.itetchologyandenglish.home.enetity;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.annotation.MultipartConfig;
import java.util.Date;
@ApiModel("订单实体")
@Data
public class Orders {
    private Integer pageNum;
    private Integer orderId;
    private String orderNamech;
    private String orderNameen;
    public String summary;
    private Integer businessId;
    private String businessName;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format="yyyy-MM-dd")
    private Date publishTime;
    private String img1;
    private String img2;
    private String img3;
    private Integer clickCount;
    private String goodsName;
    private Integer number;
    private String specifications;
    private Double price;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format="yyyy-MM-dd")
    private Date supplyTime;
    private Integer companyid;
    private String details;
    private Integer recomFlag;
    private Integer publishFlag;
    private String tradeFlag;
    private Integer supplyFlag;
    private Integer delFlag;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format="yyyy-MM-dd")
    private Date updateTime;
    private String companyName;
    private String category;
    private Integer operatorId;
    private String operatorName;
    private MultipartFile[] files;
    private Integer status;
    public Integer getPageNum() {
        if (pageNum == null) {
            pageNum = 1;
        }
        return pageNum;
    }
    public void setBusinessId(Integer businessId) {
        this.businessId = businessId;
        if(businessId!=null) {
            if (this.businessId == 1) {
                this.businessName = "轻工业类";
            } else if (this.businessId == 2) {
                this.businessName = "重工业类";
            } else if (this.businessId == 3) {
                this.businessName = "农业类";
            } else if (this.businessId == 4) {
                this.businessName = "纺织类";
            } else if (this.businessId == 5) {
                this.businessName = "日用百货类";
            } else if (this.businessId == 6) {
                this.businessName = "食品类";
            } else if (this.businessId == 7) {
                this.businessName = "运动休闲类";
            } else if (this.businessId == 8) {
                this.businessName = "3C产品";
            }
        }
    }

}
